#ifndef _IDALLOC_H
#define _IDALLOC_H

class ID_Alloc
{
	private:
		uint32 id;				/// id
		static ID_Alloc *instance;		/// 唯一实例
		ID_Alloc() : id(0)
		{}
		~ID_Alloc() {}
	public:
		static ID_Alloc* getInstance()
		{
			if(instance == NULL)
			{
				instance = new ID_Alloc;
				if(instance == NULL) return NULL;
				else return instance;
			}
			return instance;
		}
		static void delInstance()
		{
			delete instance;
		}
		uint32 getID()
		{
			return this->id;
		}
		uint32 alloc()
		{
			this->id++;
			return this->id;
		}
};

#endif
